package com.linsen.core.common.context;

import com.alibaba.ttl.TransmittableThreadLocal;

/**
 * 链路数据上下文
 *
 * @author zhaoyong
 * @date 2023/3/11
 */
public final class TraceContextHolder {
    private final static TransmittableThreadLocal<String> TRACE_CONTEXT = new TransmittableThreadLocal<>();

    public static void setTraceId(String traceId) {
        TRACE_CONTEXT.set(traceId);
    }

    public static String getTraceId() {
        return TRACE_CONTEXT.get();
    }

    public static void removeTraceId() {
        TRACE_CONTEXT.remove();
    }
}
